package model.constraints.XDFC;

public class XDFConditional {
	
	private String valExpected;
	private String valueXml;
	private String equation;
	private Boolean result;
	private Integer position;//essa posicao sera usada para saber qual pos do array de inters colocar a condicional
	
	public XDFConditional() {}
	
	public XDFConditional(String equation){
		this.equation = equation;
	}
	
	public XDFConditional(String expected, String equation, Integer position){
		this.equation = equation;
		this.valExpected = expected;
		this.position = position;
		this.result = null;
	}	
	
	public String getValExpected() {
		return valExpected;
	}
	
	public void setValExpected(String valExpected) {
		this.valExpected = valExpected.replace("'", "");
	}
	
	public String getEquation() {
		return equation;
	}
	
	public void setEquation(String equation) {
		this.equation = equation;
	}
	
	public Boolean getResult() {
		return result;
	}
	
	public void setResult(Boolean result) {
		this.result = result;
	}	
	
	public void setValueXml(String valueXml) {
		this.valueXml = valueXml;
	}

	public String getValueXml() {
		return valueXml;
	}

	public void setPosition(Integer position) {
		this.position = position;
	}

	public Integer getPosition() {
		return position;
	}	
	
	public String toString(){
		String str = new String();
		
		str = "[ " + position + " - ";
		
		if(valExpected != null)
			str += "Expected Value: " + valExpected;
		if(equation != null)
			str += "- Equation: " + equation;
		
		if(result != null){
			str += "- Result:" + result;
			if(valueXml != null )
				str += " - Value Found:" + valueXml;			
		}
		str += "]";
		return str;
	}
}
